# -*- coding:utf-8 -*-
import os
import sys


class JenkinsConfig(object):
    """这个地方是专门获取jenkins配置并返回用的"""

    def __init__(self):
        try:
            self.environ = os.environ['env']
        except Exception as e:
            '''如果不走jenkins配置，默认环境'''
            self.environ = '预发布环境'
            print(e)

    def jenkins_config(self):
        environ = self.environ
        if environ == '线上环境':
            environ = "online"
        elif environ == "预发布环境":
            environ = "yfb"
        elif environ == "T9测试环境":
            environ = "test9"
        elif environ == "T8测试环境":
            environ = "test8"
        elif environ == "T7测试环境":
            environ = "test7"
        elif environ == "T6测试环境":
            environ = "test6"
        elif environ == "T5测试环境":
            environ = "test5"
        elif environ == "T4测试环境":
            environ = "test4"
        elif environ == "T3测试环境":
            environ = "test3"
        elif environ == "T2测试环境":
            environ = "test2"
        elif environ == "T1测试环境":
            environ = "test1"
        else:
            print('选项错误,程序退出测试')
            sys.exit()
        return environ
